package com.restlet.spike.resource;

import org.restlet.data.MediaType;
import org.restlet.data.Response;
import org.restlet.data.Request;
import org.restlet.resource.*;
import org.restlet.Context;

public class AccountResource extends Resource {
    private String user;

    public AccountResource(Context context, Request request, Response response) {
        super(context, request, response);
        user = (String) request.getAttributes().get("user");
        getVariants().add(new Variant(MediaType.TEXT_PLAIN));
    }

    @Override
    public Representation represent(Variant variant) throws ResourceException {
        String message = "Account of user \"" + user + "\"" + "retrived!";
        Representation representation = new StringRepresentation(message, MediaType.TEXT_PLAIN);
        return representation;
    }
    
    @Override
    public void removeRepresentations() throws ResourceException {
        // do nothing
    }
}